package java_thinking.unit_18_IO._18_7;

import java.io.IOException;
import java.util.*;

/**
 * @Desc:   读取二进制并且统计
 * @author: cww
 * @DateTime: 2019-05-15 23:38
 */

public class E19_BytesInfo {
    static String file = "src/maindemo/java/java_thinking/unit_18_IO/_18_7/E19_BytesInfo.java";
    public static void main(String[] args) throws IOException {
        Map<Byte,Integer> stat = new HashMap<>();
        for (Byte bt : BinaryFile.read(file)) {
            Integer in = stat.get(bt);
            stat.put(bt,in == null ? 1 : in + 1);
        }
        List<Byte> list = new ArrayList<>(stat.keySet());
        Collections.sort(list);
        for (Byte b1 : list) {
            System.out.println(b1 + "==> " + stat.get(b1));
        }
    }

}
